//
//  ArticleCommonTableViewCell.m
//  MyProject
//
//  Created by dllo on 15/10/29.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ArticleCommonTableViewCell.h"

#define WIDTH ([UIScreen mainScreen].bounds.size.width/375)
#define HEIGH ([UIScreen mainScreen].bounds.size.height/667)
@implementation ArticleCommonTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.EnglishLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.EnglishLabel];
        
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLabel];
        
        self.bgImage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.bgImage];
        
        self.timeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.timeLabel];
        
        self.shareImage = [[UIImageView alloc]init];
        self.shareImage.image = [UIImage imageNamed:@"iconfont-fenxiang@2x.png"];
        [self.contentView addSubview:self.shareImage];
        
        self.loveImage = [[UIImageView alloc]init];
        self.loveImage.image = [UIImage imageNamed:@"iconfont-xihuan-2@2x.png"];
        [self.contentView addSubview:self.loveImage];
        
        self.commentImage = [[UIImageView alloc]init];
        self.commentImage.image = [UIImage imageNamed:@"iconfont-pinglun@2x.png"];
        [self.contentView addSubview:self.commentImage];
        
        self.commenNumimage = [[UIImageView alloc]init];
        self.commenNumimage.image = [UIImage imageNamed:@"iconfont-yuanjuxing-2@2x.png"];
        self.commenNumimage.layer.cornerRadius = 5;
        self.commenNumimage.clipsToBounds = YES;
        [self addSubview:self.commenNumimage];
        
        self.commentLabel = [[UILabel alloc]init];
        self.commentLabel.font = [UIFont systemFontOfSize:13 * WIDTH * HEIGH];
        self.commentLabel.textColor = [UIColor whiteColor];
        [self.commentLabel sizeToFit];
        [self addSubview:self.commentLabel];
//        
//        self.nightView = [[UIView alloc]init];
//        if (![[NSUserDefaults standardUserDefaults] boolForKey:@"isWhite"]) {
//            self.nightView.backgroundColor = [UIColor blackColor];
//            self.nightView.alpha = 0.5;
//            [self.bgImage addSubview:self.nightView];
//                   }else{
//                       self.nightView = [[UIView alloc]init];
//                       self.nightView.backgroundColor = [UIColor clearColor];
//                       self.nightView.alpha = 0;
//                       [self.bgImage addSubview:self.nightView];
//        }
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.EnglishLabel.frame = CGRectMake(self.contentView.bounds.size.width/2- 40 * WIDTH, 5 * HEIGH , self.contentView.bounds.size.width, 20 * WIDTH * HEIGH);
    self.titleLabel.frame = CGRectMake(self.contentView.bounds.size.width/2-25 * WIDTH , 30 * HEIGH, self.contentView.bounds.size.width, 20 * HEIGH);
    self.bgImage.frame = CGRectMake(0, 60 * HEIGH, self.contentView.bounds.size.width, 280 * HEIGH);
    self.shareImage.frame = CGRectMake(15 * WIDTH, 345 * HEIGH, 20 * WIDTH, 20 * HEIGH);
    self.loveImage.frame = CGRectMake(70 * WIDTH, 345 * HEIGH, 20 * WIDTH, 20 * HEIGH);
    self.commentImage.frame = CGRectMake(120 * WIDTH, 340 * HEIGH, 30 * WIDTH, 30 * HEIGH);
//    self.timeLabel.frame = CGRectMake(210, 220, 310, 30);
    self.commenNumimage.frame = CGRectMake(135 * WIDTH, 334 * HEIGH , 30 * WIDTH, 15 * HEIGH);
    self.commentLabel.frame = CGRectMake(140 * WIDTH, 332 * HEIGH, 30 * WIDTH, 20 * HEIGH);
    self.nightView.frame = self.bgImage.bounds;

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
